package com.atguigu.realtime.gmallpublisher.mapper;

import com.atguigu.realtime.gmallpublisher.bean.ProvinceStats;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/3/27 9:54
 */
public interface ProvinceStatsMapper {
    
    /*
    SELECT
    province_name,
    sum(order_amount) AS order_amount
FROM province_stats_2021
WHERE toYYYYMMDD(stt) = 20210326
GROUP BY
    province_id,
    province_name
     */
    @Select("SELECT\n" +
        "    province_name,\n" +
        "    sum(order_amount) AS order_amount\n" +
        "FROM province_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY\n" +
        "    province_id,\n" +
        "    province_name")
    List<ProvinceStats> getProvinceStats(int date);
}
